/**
 * Created by qingmai on 2017/2/17.
 */
var gulp = require('gulp'),
    config = require('../config'),
    livereload = require('gulp-livereload'),
    order = require("gulp-order"),
    concat = require('gulp-concat');

// 合并js
gulp.task('jslist',function () {
    gulp.src(config.src.scripts)
        .pipe(order([
            'index.js',
            'home.js',
            ]))
        .pipe(concat('index.js'))    //合并文件名
        .pipe(gulp.dest(config.dest.scripts))
        .pipe(livereload());
});
gulp.task('jsjont',function () {
    gulp.src(config.src.js)
        .pipe(gulp.dest(config.dest.scripts))
        .pipe(livereload())
});
gulp.task('script',function () {
    gulp.watch(config.src.scripts,['jslist']);
    gulp.watch(config.src.js,['jsjont']);
    livereload.listen();
})